<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/4/15
  Time: 15:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <title>登录</title>
    <link rel="icon" href="<c:url value="/img/login.jpeg"/>"/>
    <link rel="stylesheet" href="<c:url value="/webjars/bootstrap/4.3.1/css/bootstrap.min.css"/>"/>
    <script src="<c:url value="/webjars/jquery/3.0.0/jquery.min.js"/>"></script>
    <script src="<c:url value="/webjars/bootstrap/4.3.1/js/bootstrap.min.js"/>"></script>
</head>

<script>
    (function () {
        'use strict';
        window.addEventListener('load', function () {
            // Fetch all the forms we want to apply custom Bootstrap validation styles to
            var forms = document.getElementsByClassName('needs-validation');
            // Loop over them and prevent submission
            var validation = Array.prototype.filter.call(forms, function (form) {
                form.addEventListener('submit', function (event) {
                    if (form.checkValidity() === false) {
                        event.preventDefault();
                        event.stopPropagation();
                    }
                    form.classList.add('was-validated');
                }, false);
            });
        }, false);
    })();

    <%--var errori ='<%=request.getParameter("error")%>';--%>
    <%--if(errori == 'yes'){--%>
    <%--    alert("用户名或密码错误");--%>
    <%--}--%>
</script>
<link href="<c:url value="/css/sign_in.css"/>" rel="stylesheet">

<body class="text-center">
    <div class="container">
        <div class="jumbotron-fluid">
            <img src="<c:url value='/img/login.jpeg'/>" style="border-radius: 10px;width: 72px;height: 72px">
            <form class="form-signin needs-validation" novalidate action="<c:url value='/manager/checkLogin'/>" method="post">

                <h1 class="h3 mb-3 font-weight-normal">登录今日校园系统</h1>

                <div class="form-group">
                    <label for="loginId" class="sr-only">account number</label>
                    <input type="text" id="loginId" name="loginId" class="form-control" placeholder="请输入账号" pattern="[1-9][0-9]{7}" required>
                    <%--提示信息--%>
                    <div class="invalid-feedback">验证不过：请输入正确的8位账号</div>
                </div>

                <div class="form-group">
                    <label for="pwd" class="sr-only">Password</label>
                    <input type="password" id="pwd" name="pwd" class="form-control" placeholder="请输入密码" pattern=".{4,10}" required>
                </div>

                <c:if test="${loginMsg != null}">
                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                        <strong>注意！</strong> <c:out value="${loginMsg}"/>
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                </c:if>
                <c:remove var="loginMsg" scope="session"/>
                <button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
                <p class="mt-5 mb-3 text-muted">© 2020-2021</p>
            </form>
        </div>
    </div>
</body>
</html>
